﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Ui视图ID
/// </summary>
public enum ViewId
{
    None,
    LoginUi=1,
    RegisterUi=2,
    DemoUi=10,
    SuperList=20,
    SuperGrid=30,
    MessageUi=100,
    Max,
}

/// <summary>
/// 配置管理
/// </summary>
public class UiConfigManger
{
    #region 视图层
    public const int None = -1;
    public const int Back = 100;//最底层，各种UI按钮，比如进入系统的按钮
    public const int System = 200;//系统级，比如好友系统，社交系统，任务系统等...
    public const int System_Login = 201;
    public const int System_Register = 202;
    public const int Menu = 300;//菜单，放在系统级上层
    public const int Dialog = 400;//对话
    public const int MessageBox = 500;//消息盒子，掉线了，上线了，
    public const int MessageTip = 600;//消息提示,比如得到多少经验，道具
    public const int Story = 700;//剧情
    public const int Guide = 800;//剧情引导
    public const int Loading = 900;//加载，切场景等
    public const int Max = 1000;//最大层
    #endregion

    #region prefab路径
    private const string SuperList_Path = "GameUi/SuperListUi/prefab/SuperListUi";
    private const string SuperGrid_Path = "GameUi/SuperGridUi/prefab/SuperGridUi";
    private const string LoginView_Path = "GameUi/LoginView/LoginUi";
    private const string RegisterView_Path = "GameUi/RegisterView/RegisterUi";
    private const string MessageView_Path = "GameUi/MessageView/MessageUi";
    #endregion

    private static Dictionary<int, UiConfig> uiDictionary = new Dictionary<int, UiConfig>()
    {
        {(int)ViewId.SuperList,new UiConfig((int)ViewId.SuperList,SuperList_Path,System) },
        {(int)ViewId.SuperGrid,new UiConfig((int)ViewId.SuperGrid,SuperGrid_Path,System) },
        {(int)ViewId.LoginUi,new UiConfig((int)ViewId.LoginUi,LoginView_Path,System_Login) },
        {(int)ViewId.RegisterUi,new UiConfig((int)ViewId.RegisterUi,RegisterView_Path,System_Register) },
        {(int)ViewId.MessageUi,new UiConfig((int)ViewId.MessageUi,MessageView_Path,MessageTip) }
    };

    /// <summary>
    /// 获取配置
    /// </summary>
    /// <param name="viewId"></param>
    /// <returns></returns>
    public static UiConfig GetConfig(int viewId)
    {
        if (uiDictionary.ContainsKey(viewId))
        {
            return uiDictionary[viewId];
        }

        return null;
    }


}
